﻿namespace Customer.Core.Data.DataContextStorage
{
    public class DataContextFactory
    {
        public static CustomerEntities GetDataContext()
        {
            IDataContextStorageContainer dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer();

            CustomerEntities customerEntities = dataContextStorageContainer.GetDataContext();

            if (customerEntities == null)
            {
                customerEntities = new CustomerEntities();
                dataContextStorageContainer.Store(customerEntities);
            }

            return customerEntities;
        }
    }
}
